package com.simplebundle;

import com.osgi.desktop.bundle.BasicActivator;
import com.simplebundle.ui.actions.AdicionaTelaNoFramework;
import com.simplebundle.ui.actions.ShowSimpleBundleWindowAction;
import javax.swing.JButton;
import org.osgi.framework.BundleContext;

public class Activator extends BasicActivator {
    private JButton simpleButtonWindow;
    private ShowSimpleBundleWindowAction showSimpleBundleWindowAction;
    private AdicionaTelaNoFramework adicionaTelaNoFramework;
    
    @Override
    public void myStart(BundleContext bundleContext) throws Exception {
        this.adicionaTelaNoFramework = new AdicionaTelaNoFramework(tabbedPaneService);
        showSimpleBundleWindowAction = new ShowSimpleBundleWindowAction(adicionaTelaNoFramework);
        simpleButtonWindow = addActionInToolBar(showSimpleBundleWindowAction);
    }

    @Override
    public void myStop(BundleContext bundleContext) throws Exception {
        removeBasicWindow(showSimpleBundleWindowAction.basicWindow());
        removeActionFromToolBar(simpleButtonWindow);
    }
}